import { register } from "@antv/x6-vue-shape";

// 注册组件
let defPortAttrs = {
    // default
    circle: {
        r: 4,
        magnet: true,
        stroke: "#5B8FFA",
        strokeWidth: 1,
        fill: "#ffffff",
    },
};
/**
 * @param {*} portAttrs 连接桩样式
 */
export function creatRegister(shape, component, portAttrs, noPort) {
    portAttrs = portAttrs ? portAttrs : defPortAttrs;
    register({
        shape: shape,
        component: component,
        inherit: "vue-shape",
        ports: {
            groups: {
                bottom: {
                    position: "bottom",
                    attrs: {
                        circle: Object.assign({}, portAttrs.circle, {
                            cy: -4,
                        }),
                    },
                },
                top: {
                    position: "top",
                    attrs: {
                        circle: Object.assign({}, portAttrs.circle, {
                            cy: 5,
                        }),
                    },
                },
                left: {
                    position: "left",
                    attrs: {
                        circle: Object.assign({}, portAttrs.circle, {
                            cx: 5,
                        }),
                    },
                },
                right: {
                    position: "right",
                    attrs: {
                        circle: Object.assign({}, portAttrs.circle, {
                            cx: -5,
                        }),
                    },
                },
            },
            items: [],
        },
    });
}